package com.kyivmohyla.kma2.dao.mapper;

import com.kyivmohyla.kma2.model.Position;
import org.springframework.jdbc.core.ResultSetExtractor;

import java.sql.ResultSet;
import java.sql.SQLException;

class PositionResultSetExtractor implements ResultSetExtractor<Position> {

    @Override
    public Position extractData(ResultSet resultSet) throws SQLException {
        Position position = new Position();
        try {
            position.setPositionId(resultSet.getInt("position_id"));
            position.setName(resultSet.getString("name"));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return position;
    }

}